package com.chatplus.application.processor;

import com.chatplus.application.processor.channel.chat.IChatAiProcessorService;
import org.springframework.stereotype.Service;

import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * AI渠道处理器提供者
 *
 * @author liexuan
 * @date 2022-08-16 14:00
 **/
@Service
public class AIChannelServiceProvider {
    public static final String SERVICE_NAME_PRE = "aiChannelService";

    private final Map<String, IChatAiProcessorService> aiChannelServiceMap = new HashMap<>();

    public AIChannelServiceProvider(List<IChatAiProcessorService> payChannelServices) {
        for (IChatAiProcessorService aiChannelService : payChannelServices) {
            aiChannelServiceMap.put(aiChannelService.getChannel(), aiChannelService);
        }
    }

    /**
     * 获取支付渠道处理器
     *
     * @param channel 支付渠道
     * @return PayChannelService
     */
    public IChatAiProcessorService getPayChannelService(String channel) {
        return aiChannelServiceMap.get(channel);
    }

}
